package flc.ast.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

import java.text.DecimalFormat;

import flc.ast.R;
import flc.ast.bean.OvertimeBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

public class OvertimeChildAdapter extends StkProviderMultiAdapter<OvertimeBean> {

    public OvertimeChildAdapter() {
        addItemProvider(new OvertimeChildProvider());
    }

    private class OvertimeChildProvider extends BaseItemProvider<OvertimeBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_overtime;
        }

        @Override
        public void convert(@NotNull BaseViewHolder baseViewHolder, OvertimeBean bean) {
            String format = "%.1f";
            baseViewHolder.setText(R.id.tvOvertimeItemName, bean.getName());
            baseViewHolder.setText(R.id.tvOvertimeItemHour, getContext().getString(R.string.hour_income_str, String.format(format, bean.getHour())));
            baseViewHolder.setText(R.id.tvOvertimeItemDuration, getContext().getString(R.string.hour_num, String.format(format, bean.getDuration())));
            baseViewHolder.setText(R.id.tvOvertimeItemIncome, getContext().getString(R.string.income_num, String.format(format, bean.getIncome())));
        }
    }
}
